<!--Descriptive page name, messages and instructions-->
<h2><%=h t('.edit_multiple', :default => "Editing Multiple Works") %></h2>
<!--/descriptions-->

<!--subnav-->
<!--/subnav-->

<!--main content-->
<%= form_for :work, :url => update_multiple_user_works_path(@user), :html => { :method => :put } do |form| %>
  <h3>Works Edited</h3>
  <p class="important message">
    <%= ts "Note that your edits will be applied to <em>all</em> of these stories, <em>replacing</em> any existing values for these fields!" %>
  </p>

  <table summary="lists the works being mass-edited">
    <caption>Lists the works being mass-edited.</caption>
    <thead>
      <tr>
        <th scope="col">Title</th>
        <th scope="col">Fandom</th>
        <th scope="col">Other Tags</th>
      </tr>
    </thead>
    <% for work in @works %>
      <tr>
      	<th scope="row">
          <%= hidden_field_tag "work_ids[]", work.id%>
          <%= link_to work.title, work %>
        </th>
        <td><%= work.fandoms.collect {|tag| link_to_tag(tag) }.join(', ') %></td>
        <td><%= %w(characters relationships freeforms categories ratings warnings).collect {|type| work.send("#{type}")}.flatten.collect {|tag| link_to_tag(tag) }.join(', ').html_safe %></td>
      </tr>
    <% end %>
  </table>

  <p class="required message"><%=h t('.required_info', :default => "* Required information") %></p>

  <div id="work-form" class="work-form"><%= render :partial => 'work_tags_form', :locals => {:include_blank => true} %></div>

  <p class="submit"><%= submit_tag t('.update_multiple', :default => "Update All Stories"), :confirm => "Are you sure? Remember this will replace all existing values!" %></p>

<% end %>
<!--/content-->

